﻿using System;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Web;
using System.Collections.Generic;

namespace RedSand.Site.Models
{
    public class ActionInfo
    {
        public int ActionID { get; set; }
        public bool Parent { get; set; }
        public string Link{ get; set; }
        public string ResourceTag { get; set; }
        public string ResourceGroup { get; set; }
    }
    public class ActionList
    {
        public static System.Collections.Generic.List<ActionInfo> Items
        {
            get
            {
                var list = (List<ActionInfo>)HttpContext.Current.Cache["ActionList"];
                if (list == null)
                {
                    list = AddActionToList();
                    HttpContext.Current.Cache["ActionList"] = list;
                }
                return list;
            }
        }
        private static List<ActionInfo> AddActionToList()
        {
            List<ActionInfo> list = new List<ActionInfo>();

            //return list;

            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/action/(manager)|(save)", ResourceTag = "ActionManager", ResourceGroup = "Action", Parent = true });

            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/guide/manager", ResourceTag = "GuideManager", ResourceGroup = "Guide", Parent = true });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/category/manager/2", ResourceTag = "GuideCategory", ResourceGroup = "Guide" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/guide/create", ResourceTag = "GuideCreate", ResourceGroup = "Guide" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/category/create/2", ResourceTag = "GuideCategoryCreate", ResourceGroup = "Guide" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/guide/delete", ResourceTag = "GuideDelete", ResourceGroup = "Guide" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/category/delete/2", ResourceTag = "GuideCategoryDelete", ResourceGroup = "Guide" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/category/edit/2", ResourceTag = "GuideCategoryEdit", ResourceGroup = "Guide" });

            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/news/manager", ResourceTag = "NewsManager", ResourceGroup = "News", Parent = true });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/category/manager/1", ResourceTag = "NewsCategory", ResourceGroup = "News" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/news/create", ResourceTag = "NewsCreate", ResourceGroup = "News" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/category/create/1", ResourceTag = "NewsCategoryCreate", ResourceGroup = "News" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/news/delete", ResourceTag = "NewsDelete", ResourceGroup = "News" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/category/delete/1", ResourceTag = "NewsCategoryDelete", ResourceGroup = "News" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/news/edit", ResourceTag = "NewsEdit", ResourceGroup = "News" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/news/edit/1", ResourceTag = "NewsCategoryEdit", ResourceGroup = "News" });

            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/request/manager", ResourceTag = "RequestManager", ResourceGroup = "Request", Parent = true });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/request/create", ResourceTag = "RequestCreate", ResourceGroup = "Request" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/request/delete", ResourceTag = "RequestDelete", ResourceGroup = "Request" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/request/edit", ResourceTag = "RequestEdit", ResourceGroup = "Request" });

            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/faq/manager", ResourceTag = "FaqManager", ResourceGroup = "FAQ", Parent = true });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/faq/create", ResourceTag = "FaqCreate", ResourceGroup = "FAQ" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/faq/delete", ResourceTag = "FaqDelete", ResourceGroup = "FAQ" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/faq/edit", ResourceTag = "FaqEdit", ResourceGroup = "FAQ" });


            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/role/manager", ResourceTag = "RoleManager", ResourceGroup = "Role", Parent = true });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/role/create", ResourceTag = "RoleCreate", ResourceGroup = "Role" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/role/delete", ResourceTag = "RoleDelete", ResourceGroup = "Role" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/role/edit", ResourceTag = "RoleEdit", ResourceGroup = "Role" });
            
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/support/manager", ResourceTag = "SupportManager", ResourceGroup = "Support", Parent = true });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/support/create", ResourceTag = "SupportCreate", ResourceGroup = "Support" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/support/delete", ResourceTag = "SupportDelete", ResourceGroup = "Support" });
            list.Add(new ActionInfo { ActionID = list.Count + 1, Link = @"/support/edit", ResourceTag = "SupportEdit", ResourceGroup = "Support" });


            return list;
        }
    }
}
